package org.example.springboot01.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.springboot01.pojo.User;

@Mapper
public interface Usermapper {
    @Select("select * from users where username=#{username}")
    User Findbyusername(String username);
    @Insert("insert into users(username,userpassword) values(#{username},#{userpassword})")
    void adduser(String username, String userpassword);
    @Update("update users set nickname = #{nickname},email = #{email},update_time = now() where username = #{username}")
    void updateuser(User user);
    @Update("update users set avatar = #{avatar} ,update_time = now() " +
            "where username = #{username}")
    void updateavatar(String avatar,String username);
    @Update("update users set userpassword  =#{npwd} where username = #{username}")
    void updatepassword(String npwd,String username);
}
